home *** CD-ROM | disk | FTP | other *** search
/ Modeling the Dream / Modeling the Dream CD - Walkthroughs and Flybys II (1994)(Waite Group).iso / spacebar / chess.txt < prev    next >
Text File  |  1994-09-14  |  10KB  |  602 lines

  1. set maxcall on
  2. set swappath "c:\temp"
  3. init
  4. localise
  5. chess
  6. terminate
  7.  
  8.  
  9. chess:                ;-------- start chess ------------
  10. midpak volume 80
  11. local leadingzero "0"
  12. local flic ""            ;the current flic
  13. local fil 0            ;array to hold filename
  14. local buf 0            ;array to hold buffer name
  15. local fra 0            ;array to hold frame to play
  16. local total 0            ;number of elements in array
  17. local numlad 0            ;number of sound files to load
  18. local lad 1             ;array for files to load
  19. local numflics 44        ;number of flics in sequence
  20. local k "a"
  21. global playspeed 4
  22. global thispath "\\flics\\mulholla\\"
  23. runmode                ;check in from CD or hard disk
  24.  
  25. databegin chesstable
  26. gtop:                ;build arrays
  27.  set "fil"$@total @        ;the flic file
  28.  set "buf"$@total @        ;the sound effect
  29.  set "fra"$@total @        ;frame to play it
  30.  set total @total+1        ;increment counter for num of rows
  31.  if !(@=="end")            ;read until end encountered
  32.   dataskip -1
  33.   goto gtop            ;jump back
  34.  endif
  35.  
  36. mp chess            ;start midi music
  37.  
  38. databegin chesstable        ;open table and grab first record
  39. set fl @
  40. set bf @
  41. set fr @ 
  42.  
  43. mark @numflics                ;start main loop
  44.  set flic @loop-1                ;store current flic name
  45.                      ;start of block locate sfx per flic
  46.  set numlad 0                ;reset number of effects for flic=0
  47.  mark @total                ;once through for each row of table
  48.   if @("fil"$@loop-1)==@flic             ;is there an sfx for current file on
  49.                     ;this row?
  50.    set tmpbuf @("buf"$@loop-1)        ;Yes so store name of effect
  51.    set flag 0                ;assume sfx has not already been tagged
  52.    if @numlad>0                ;have any sfxs been found for this flic
  53.     mark @numlad            ;they have so run list again
  54.      if @tmpbuf==@("lad"$@loop)        ;look for this sfx against ones found
  55.       set flag 1            ;this sfx already in array lad
  56.      endif
  57.     loop
  58.     if !@flag                ;sfx was found that is not in array lad
  59.      set numlad @numlad+1        ;increment total to load
  60.      set "lad"$@numlad @tmpbuf        ;add sfx as new indice
  61.     endif
  62.    else                    ;sfx found with lad total=0
  63.      set numlad 1            ;there is one now
  64.      set lad1 @tmpbuf            ;set first element in array
  65.    endif
  66.   endif 
  67.  loop
  68.  if @numlad>0                ;list of sfxes for flic in lad
  69.   window
  70.   mark @numlad
  71.    load @c$"\\bigdemo\\"$@("lad"$@loop)$".raw"
  72.    unlock  @("lad"$@loop)
  73.   loop
  74.  endif
  75.  
  76.  if @loop<11                ;do we need to pad the file name
  77.   set leadingzero "0"            ;with a 0?
  78.  else
  79.   set leadingzero ""
  80.  endif
  81.  
  82.  dload @drive@thispath$"chess"$@leadingzero$(@loop-1)$".fli" d1 1 
  83.  putdff d1 0 0 0 
  84.  
  85.  mark (d1->frames)-1            ;play flic by frames
  86.   putdff d1 @playspeed @loop @loop
  87.  
  88.  
  89.   if @loop-1==@fr&&@fl==@flic
  90.    digpak preloaded @@bf
  91.    digpak play 
  92.    set fl @
  93.    set bf @
  94.    set fr @  
  95.   endif 
  96.  
  97.   waitkey 0                ;flush keyboard buffer
  98.   getkey k name                ;check for a key
  99.   if @k==return
  100.    break terminate
  101.   endif
  102.  
  103.  loop
  104.  ahead:
  105.  dfree d1
  106.  
  107.  waitkey 40                ;half second delay at end of ea flic
  108.                      ;so can hear sfx
  109.  digpak stop                ;stop digpak before unloading
  110.  if @numlad>0                ;list of sfxes for flic in lad
  111.   window
  112.   mark @numlad
  113.    free @("lad"$@loop)$".raw"
  114.   loop
  115.  endif
  116. loop
  117.  
  118. chessout:
  119. dfree d1
  120. goto terminate
  121. return                    ;----------end chess ---------
  122.  
  123.  
  124.  
  125.  
  126. init:
  127. video l
  128. global cr chr(10)$chr(13)               
  129. global ext ""
  130. local trip 1            ;does the sound play?, set to false
  131. . chdir(@c$"\\bigdemo")
  132. opengl @c$"\bigdemo\bigdemo.ovr"
  133. load midpak
  134. @midpak verify
  135. closegl
  136. if !@0
  137.  text "The MIDPAK.COM driver is not loaded!"$@cr
  138.  text "Press any key to return to DOS."
  139.  wait
  140.  exit
  141. endif
  142.  
  143. if !envdef(c)
  144.  text "No C environment variable! "@cr
  145.  text "To run BIGDEMO from DOS use GO.BAT"@cr
  146.  wait
  147.  exit
  148. endif
  149.  
  150. when ESC goto terminate 
  151.  
  152. set fs open(@t$"\mtd\midpak.adv")    ;How big is MIDPAK.ADV
  153. local advsize size(@fs)            ;stick it in ADVSIZE
  154. . close(@fs)
  155.  
  156. databegin                ;sizes of the wave drivers
  157. "44836"
  158. "10590" 
  159. "10816"
  160. "10590"
  161. "7178"
  162. "10590 "
  163. "39859"
  164. "end"
  165. dataend
  166.  
  167. local x @                ;grab first item into var
  168. advhop:
  169. if @x!="end"
  170.  if @x==@advsize
  171.   text "Using wave table synthesis for MIDI"@cr
  172.   set ext ".gen"
  173.   goto advdone
  174.  else
  175.   local x @
  176.   goto advhop
  177.  endif
  178. endif
  179. text "Using frequency modulation (FM) MIDI files"@cr
  180. set ext ".opl"
  181. advdone:
  182.  
  183. opengl @c$"\bigdemo\bigdemo.ovr"
  184. load midpak.grp digpak.grp               ;load grps
  185. closegl
  186. if !@0
  187.  text "Error loading GRP files"
  188.  wait
  189.  exit
  190. else
  191.  text "GRPs loaded..."$@cr
  192. endif
  193.  
  194. . chdir(@c$"\\bigdemo")
  195. load "_laser.raw"
  196. digpak preloaded @_laser
  197. digpak play 
  198.  
  199. tt:
  200. digpak done
  201. if !@0
  202.  set trip 0
  203.  goto tt
  204. endif
  205. free laser
  206.  
  207. if @trip
  208.  text "Sound didn't play!!!!"@cr
  209.  wait 
  210.  exit
  211. else
  212.  text "Sound appears to be playing correctly"@cr
  213. endif
  214. midpak volume 100                      ;MIDPAK driver has internal vol control
  215.                     ;mixer levels for MIDI!!!
  216. text "Press Enter to start now"@cr@cr@cr
  217. text "At runtime pressing Enter will advance"@cr@cr@cr
  218. text "Press Esc at anytime to terminate"@cr@cr@cr
  219. text "Pausing for 10 seconds"
  220.  
  221. flushkey
  222.  
  223. mark 10
  224.  wait 100
  225.  text "."
  226.  waitkey 0
  227.  getkey k name                       
  228.  if @k==return
  229.   return
  230.  endif
  231. loop
  232. return                    ;--------------- end of init
  233.  
  234.  
  235. localise:                ;subroutine checks for flics on hd
  236.                     ;and copies them if possible.
  237. local ax 0 bx 0 cx 0 freebytes 0 chcnt 0 chfile " " downed 0
  238. local runcd 0
  239. . chdir(@t$"\\mtdtemp")
  240. global fromcd 0
  241. int 0x21 0x3600,,,0x0000        ;default drive
  242. if @ax==0xffff
  243.  text "Problem getting free disk space"
  244.  pause
  245.  exitnow
  246. endif
  247. set freebytes (@ax*@bx*@cx)/1000
  248. if @freebytes>=30000
  249.  set enuf 0
  250. else 
  251.  set enuf 1
  252. endif
  253.  
  254. color 0
  255. clearscr
  256. color 15
  257. window
  258.  
  259. databegin ckl
  260. loctop:
  261.  . chdir(@t$"\\mtdtemp")
  262.  set chfile @
  263.  if @chfile<>"end"
  264.   local temp open(@chfile)                               
  265.   if @temp                  
  266.    local success close(@temp)   
  267.   else
  268. ;   text @chfile$": file not found"$@cr
  269.    set downed 1
  270.   endif                     
  271. goto loctop
  272.  endif
  273.  . chdir(@t$"\\mtd")
  274. if @downed==0
  275.  text 0 0 "The requisite file have been found in MTDTEMP"
  276.  waitkey 100
  277.  set fromcd 1
  278.  global drive @t
  279.  return
  280. endif
  281. if @downed==1&&@enuf==0
  282.  databegin
  283.  "You have more than 30MB free on this drive! 
  284.  
  285.  
  286. Press C if you would like to run the MIDPAK BigDemo from the CD, or
  287.  
  288.  
  289. Press D to download the graphics to your hard disk for faster playback.
  290.  
  291.  
  292. Please press either C or D now:"
  293.  dataend
  294.  window
  295.  color 0
  296.  clearscr
  297.  color 15
  298.  text @
  299.  flushkey
  300.  waitkey
  301.  getkey k
  302.  if @k=="d"||"D"
  303.   set fromcd 1
  304.   set drive @t
  305.   download        ;go get the files...
  306.   return
  307.  endif  
  308.  if @k=="c"||"C"
  309.   global drive @c
  310. . chdir(@drive$"\\bigdemo")
  311.   return        ;play as per normal
  312.  endif
  313. endif
  314. if @enuf==1&&@downed==1
  315.   global drive @c
  316. . chdir(@drive$"\\bigdemo")
  317.   return        ;play as per normal
  318. endif
  319. return
  320.  
  321. runmode:
  322. if @fromcd==1
  323.  set thispath "\\mtdtemp\\"
  324. endif
  325. return
  326.  
  327. mp:
  328. midpak use @c$"\\bigdemo\\"$@1$@ext
  329. midpak play
  330. return
  331.  
  332. playit:
  333. dload @1 d1 1 
  334. putdff d1 0 0 0 
  335. mark (d1->frames)-1
  336.  putdff d1 @playspeed @loop @loop
  337.  waitkey 0
  338.  getkey k name
  339.  if @k==return
  340.   set broken 1 
  341.   break playout
  342.  endif
  343. loop
  344. playout:
  345. dfree d1
  346. return
  347.  
  348.  
  349. terminate:
  350.  when esc
  351.  digpak quit                 ;implicit loading
  352.  midpak stop
  353.  free digpak midpak
  354. . chdir(@c$"\\spacebar")
  355.  exitnow
  356.  
  357.  
  358.  
  359.  
  360. download:
  361. video m
  362. color 0
  363. window
  364. clearscr
  365. color 15
  366. exec c:\dos\xcopy.exe @c$"\\flics\\russam\*.fli "$@t$"\\mtdtemp"
  367. video l
  368. return
  369.  
  370. ckl:
  371. CHESS00.FLI
  372. CHESS01.FLI
  373. CHESS02.FLI
  374. CHESS03.FLI
  375. CHESS04.FLI
  376. CHESS05.FLI
  377. CHESS06.FLI
  378. CHESS07.FLI
  379. CHESS08.FLI
  380. CHESS09.FLI
  381. CHESS10.FLI
  382. CHESS11.FLI
  383. CHESS12.FLI
  384. CHESS13.FLI
  385. CHESS14.FLI
  386. CHESS15.FLI
  387. CHESS16.FLI
  388. CHESS17.FLI
  389. CHESS18.FLI
  390. CHESS19.FLI
  391. CHESS20.FLI
  392. CHESS21.FLI
  393. CHESS22.FLI
  394. CHESS23.FLI
  395. CHESS24.FLI
  396. CHESS25.FLI
  397. CHESS26.FLI
  398. CHESS27.FLI
  399. CHESS28.FLI
  400. CHESS29.FLI
  401. CHESS30.FLI
  402. CHESS31.FLI
  403. CHESS32.FLI
  404. CHESS33.FLI
  405. CHESS34.FLI
  406. CHESS35.FLI
  407. CHESS36.FLI
  408. CHESS37.FLI
  409. CHESS38.FLI
  410. CHESS39.FLI
  411. CHESS40.FLI
  412. CHESS41.FLI
  413. CHESS42.FLI
  414. CHESS43.FLI
  415. CHESS44.FLI
  416. end
  417.  
  418. chesstable:
  419. 0,_C1,31
  420. 1,_C2,81
  421. 2,_C3,1
  422. 2,_C3,99
  423. 2,_C4,126
  424. 2,_C4,161
  425. 2,_C4,192
  426. 2,_C4,223
  427. 2,_C4,254
  428. 2,_C4,280
  429. 4,_C5,28
  430. 4,_C5,58
  431. 4,_C5,88
  432. 4,_C5,118
  433. 4,_C5,148
  434. 5,_C6,72
  435. 6,_C7,44
  436. 6,_C7,57
  437. 6,_C8,67
  438. 6,_C6,117
  439. 7,_C9,36
  440. 7,_C9,44
  441. 7,_C9,54
  442. 7,_C9,61
  443. 7,_C9,67
  444. 8,_C8,32
  445. 8,_C7,61
  446. 8,_C7,74
  447. 8,_C7,88
  448. 8,_C8,91
  449. 8,_C6,137
  450. 9,_C11,34
  451. 9,_C12,66
  452. 9,_C6,113
  453. 10,_C7,48
  454. 10,_C7,64
  455. 10,_C13,72
  456. 10,_C6,133
  457. 11,_C14,31
  458. 11,_C15,37
  459. 11,_C16,47
  460. 11,_C17,56
  461. 11,_C6,112
  462. 12,_C18,41
  463. 12,_C18,47
  464. 12,_C18,57
  465. 12,_C18,63
  466. 12,_C18,66
  467. 12,_C6,109
  468. 13,_C15,32
  469. 13,_C19,40
  470. 13,_C20,50
  471. 13,_C11,65
  472. 13,_C12,96
  473. 13,_C12,101
  474. 14,_C21,30
  475. 14,_C7,47
  476. 14,_C7,57
  477. 14,_C7,67
  478. 14,_C21,75
  479. 14,_C6,124
  480. 15,_C17,32
  481. 15,_C6,123
  482. 16,_C15,32
  483. 16,_C23,45
  484. 16,_C12,90
  485. 16,_C6,143
  486. 17,_C24,32
  487. 17,_C21,56
  488. 17,_C25,65
  489. 17,_C6,122
  490. 18,_c26,32
  491. 18,_c26b,42
  492. 18,_c27,67
  493. 18,_c6,122
  494. 19,_c28,32
  495. 19,_c29,73
  496. 19,_c6,136
  497. 20,_c30,42
  498. 20,_c30,61
  499. 20,_c30,81
  500. 20,_c30,101
  501. 20,_c31,111
  502. 20,_c30,156
  503. 20,_c30,162
  504. 20,_c6,202
  505. 21,_c28,32
  506. 21,_c32,49
  507. 21,_c33,63
  508. 21,_c29,81
  509. 21,_c6,122
  510. 22,_c30,51
  511. 22,_c30,61
  512. 22,_c34,85
  513. 22,_c6,165
  514. 23,_c28,32
  515. 23,_c35,73
  516. 23,_c36,81
  517. 23,_c38,136
  518. 23,_c6,196
  519. 24,_c39,32
  520. 24,_c40,73
  521. 24,_c6,134
  522. 25,_c28,32
  523. 25,_c41,51
  524. 25,_c6,132
  525. 26,_c30,51
  526. 26,_c30,72
  527. 26,_c42,82
  528. 26,_c43,102
  529. 26,_c30,137
  530. 26,_c6,178
  531. 27,_c38,32
  532. 27,_c29,106
  533. 27,_c6,147
  534. 28,_c45,44
  535. 28,_c6,104
  536. 29,_c47,29
  537. 29,_c48,54
  538. 29,_c49,82
  539. 29,_c6,139
  540. 30,_c30,51
  541. 30,_c50,70
  542. 30,_c51,111
  543. 30,_c30,131
  544. 30,_c6,172
  545. 31,_c52,32
  546. 31,_c53,58
  547. 31,_c53,70
  548. 31,_c53,82
  549. 31,_c52,95
  550. 31,_c6,152
  551. 32,_c54,41
  552. 32,_c54,51
  553. 32,_c54,61
  554. 32,_c54,71
  555. 32,_c54,76
  556. 32,_c6,116
  557. 33,_c55,32
  558. 33,_c6,147
  559. 34,_c39,32
  560. 34,_c56,50
  561. 34,_c56,60
  562. 34,_c56,70
  563. 34,_c39,83
  564. 34,_c57,102
  565. 34,_c6,143
  566. 35,_c28,32
  567. 35,_c29,91
  568. 35,_c6,132
  569. 36,_c58,32
  570. 36,_c59,40
  571. 36,_c60,48
  572. 36,_c57,79
  573. 36,_c6,120
  574. 37,_c58,32
  575. 37,_c58,71
  576. 37,_c58,91
  577. 37,_c58,101
  578. 37,_c6,144
  579. 38,_c58,32
  580. 38,_c59,40
  581. 38,_c61,48
  582. 38,_c6,132
  583. 39,_c62,22
  584. 39,_c6,101
  585. 40,_c56,43
  586. 40,_c56,60
  587. 40,_c39,90
  588. 40,_c62,32
  589. 40,_c6,142
  590. 41,_c62,32
  591. 41,_c63,51
  592. 41,_c64,61
  593. 41,_c6,113
  594. 42,_c56,30
  595. 42,_c65,52
  596. 42,_c57,71
  597. 42,_c6,113
  598. 44,_c67,32
  599. 44,_c59,49
  600. 44,_c57,68
  601. end
  602.